package com.ruoyi.behindTreatment.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.behindTreatment.domain.yyyTreatment;
import com.ruoyi.behindTreatment.service.IyyyTreatmentService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 就诊总览Controller
 * 
 * @author ruoyi
 * @date 2025-08-19
 */
@RestController
@RequestMapping("/behindTreatment/beYyyTreatment")
public class yyyTreatmentController extends BaseController
{
    @Autowired
    private IyyyTreatmentService yyyTreatmentService;

    /**
     * 查询就诊总览列表
     */
    @PreAuthorize("@ss.hasPermi('behindTreatment:beYyyTreatment:list')")
    @GetMapping("/list")
    public TableDataInfo list(yyyTreatment yyyTreatment)
    {
        startPage();
        List<yyyTreatment> list = yyyTreatmentService.selectyyyTreatmentList(yyyTreatment);
        return getDataTable(list);
    }

    /**
     * 导出就诊总览列表
     */
    @PreAuthorize("@ss.hasPermi('behindTreatment:beYyyTreatment:export')")
    @Log(title = "就诊总览", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, yyyTreatment yyyTreatment)
    {
        List<yyyTreatment> list = yyyTreatmentService.selectyyyTreatmentList(yyyTreatment);
        ExcelUtil<yyyTreatment> util = new ExcelUtil<yyyTreatment>(yyyTreatment.class);
        util.exportExcel(response, list, "就诊总览数据");
    }

    /**
     * 获取就诊总览详细信息
     */
    @PreAuthorize("@ss.hasPermi('behindTreatment:beYyyTreatment:query')")
    @GetMapping(value = "/{treatId}")
    public AjaxResult getInfo(@PathVariable("treatId") Long treatId)
    {
        return success(yyyTreatmentService.selectyyyTreatmentByTreatId(treatId));
    }

    /**
     * 新增就诊总览
     */
    @PreAuthorize("@ss.hasPermi('behindTreatment:beYyyTreatment:add')")
    @Log(title = "就诊总览", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody yyyTreatment yyyTreatment)
    {
        return toAjax(yyyTreatmentService.insertyyyTreatment(yyyTreatment));
    }

    /**
     * 修改就诊总览
     */
    @PreAuthorize("@ss.hasPermi('behindTreatment:beYyyTreatment:edit')")
    @Log(title = "就诊总览", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody yyyTreatment yyyTreatment)
    {
        return toAjax(yyyTreatmentService.updateyyyTreatment(yyyTreatment));
    }

    /**
     * 删除就诊总览
     */
    @PreAuthorize("@ss.hasPermi('behindTreatment:beYyyTreatment:remove')")
    @Log(title = "就诊总览", businessType = BusinessType.DELETE)
	@DeleteMapping("/{treatIds}")
    public AjaxResult remove(@PathVariable Long[] treatIds)
    {
        return toAjax(yyyTreatmentService.deleteyyyTreatmentByTreatIds(treatIds));
    }
}
